﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using Koonsoft.HYCRM.BLL;
using Koonsoft.HYCRM.Model;

public partial class Account_Login : System.Web.UI.Page
{
    private log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void LoginButton_Click(object sender, EventArgs e)
    {
        var userName = UserName.Text.Trim();
        var password = Password.Text.Trim();
        var otpcode = DynamicPassword.Text.Trim();

        string msg = string.Empty;

        if (!new EmpolyeeBLL().Login(userName, password, otpcode, out msg))
        {
            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript",
                                               "<script>alert('" + msg + "');</script>");

            return;
        }

        FormsAuthentication.RedirectFromLoginPage(UserName.Text.Trim(), false);
    }
}